package com.coursebooking.model;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

@TableName("student")
public class Student {
    @TableId(type = IdType.AUTO)
    private Long id;

    private String name;

    @TableField("student_id")
    private String studentId;

    private String email;

    private String phone;

    private String grade;
    // 新增字段
    private GenderEnum gender; // ENUM: 'MALE', 'FEMALE'
    private String major; // VARCHAR

    @TableField("class_name")
    private String className; // 班级

    @TableField("enrollment_year")
    private Integer enrollmentYear; // 入学年份

    @JsonFormat(pattern = "yyyy-MM-dd")
    @TableField("birth_date")
    private Date birthDate; // 出生日期
    private String address; // 地址

    // Getter 和 Setter 方法
    public GenderEnum getGender() {
        return gender;
    }

    public void setGender(GenderEnum gender) {
        this.gender = gender;
    }

    public String getMajor() {
        return major;
    }

    public void setMajor(String major) {
        this.major = major;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public Integer getEnrollmentYear() {
        return enrollmentYear;
    }

    public void setEnrollmentYear(Integer enrollmentYear) {
        this.enrollmentYear = enrollmentYear;
    }

    public Date getBirthDate() {
        return birthDate;
    }

    public void setBirthDate(Date birthDate) {
        this.birthDate = birthDate;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }
    public enum GenderEnum{
        MALE, FEMALE
    }

    @TableField(value = "created_at", fill = FieldFill.INSERT)
    private LocalDateTime createdAt;

    @TableField(exist = false)
    private List<Booking> bookings;

    @TableField(exist = false)
    private List<Review> reviews;

    // Constructors
    public Student() {}

    public Student(String name, String studentId, String email, String phone, String grade) {
        this.name = name;
        this.studentId = studentId;
        this.email = email;
        this.phone = phone;
        this.grade = grade;
    }

    // Getters and Setters
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getStudentId() {
        return studentId;
    }

    public void setStudentId(String studentId) {
        this.studentId = studentId;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getGrade() {
        return grade;
    }

    public void setGrade(String grade) {
        this.grade = grade;
    }

    public LocalDateTime getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(LocalDateTime createdAt) {
        this.createdAt = createdAt;
    }

    public List<Booking> getBookings() {
        return bookings;
    }

    public void setBookings(List<Booking> bookings) {
        this.bookings = bookings;
    }

    public List<Review> getReviews() {
        return reviews;
    }

    public void setReviews(List<Review> reviews) {
        this.reviews = reviews;
    }
}